import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/LayoutView.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    // 重定向
    redirect: '/index/focus'
  },
  {
    path: '/',
    name: 'layout',
    component: Layout,
    children: [
      {
        path: '/index',
        component: ()=> import('../views/IndexView.vue'),
        name: 'index',
        children:[
          {
            path: 'focus',
            component: ()=> import('../views/pages/FocusView.vue'),
            name: 'focus'
          },
          {
            path: 'recommend',
            component: ()=> import('../views/pages/RecommendView.vue'),
            name: 'recommend'
          },
          {
            path: 'note',
            component: ()=> import('../views/pages/NoteView.vue'),
            name: 'note'
          },
          {
            path: 'video',
            component: ()=> import('../views/pages/VideoView.vue'),
            name: 'video'
          },
          {
            path: 'active',
            component: ()=> import('../views/pages/ActiveView.vue'),
            name: 'active'
          },
    
        ]
      },
      {
        path: '/shop',
        component: ()=> import('../views/ShopView.vue'),
        name: 'shop'
      },
      {
        path: '/collect',
        component: ()=> import('../views/CollectView.vue'),
        name: 'collect'
      },
      {
        path: '/home',
        component: ()=> import('../views/HomeView.vue'),
        name: 'home'
      },
    ]
  },
  {
    path: '/search',
    component: ()=> import('../views/SearchView.vue'),
    name: 'search'
  },
  {
    path: '/searchDetail',
    component: ()=> import('../views/SearchDetail.vue'),
    name: 'searchDetail'
  },
  {
    path: '/recipesDetail',
    component: ()=> import('../views/RecipesDetail.vue'),
    name: 'recipesDetail'
  },
  {
    path: '/login',
    component: ()=> import('../views/LoginView.vue'),
    name: 'login'
  },
  {
    path: '/register',
    component: ()=> import('../views/RegisterView.vue'),
    name: 'register'
  },
  {
    path: '*',
    component: ()=> import('../views/ErrorView.vue'),
    name: 'error'
  }
]

const router = new VueRouter({
  routes
})

export default router
